import { Standard } from '.';

const zh: Standard = {
  required: ['{{attribute}}不能为空', { attribute: undefined }],
  json: {
    invalid: ['{{attribute}}必须是JSON字符串', { attribute: undefined }],
  },
  array: {
    invalid: ['{{attribute}}必须是数组格式', { attribute: undefined }],
    tooShort: [
      '{{attribute}} 至少需要包含{{minItemLength}}个数组元素',
      { attribute: undefined, minItemLength: undefined },
    ],
    tooLong: [
      '{{attribute}} 最多只能包含{{maxItemLength}}个数组元素',
      { attribute: undefined, maxItemLength: undefined },
    ],
    betweenLength: [
      '{{attribute}} 的数组元素个数必须控制在 ${minItemLength} 与 ${minItemLength} 之间',
      { attribute: undefined,  minItemLength: undefined, maxItemLength: undefined },
    ],
  },
  string: {
    invalid: ['{{attribute}} 必须是字符串', { attribute: undefined }],
    tooShort: [
      '{{attribute}} 至少需要包含{{minLength}}个字符',
      { attribute: undefined, minLength: undefined },
    ],
    tooLong: [
      '{{attribute}} 最多只能包含{{maxLength}}个字符',
      { attribute: undefined, maxLength: undefined },
    ],
    betweenLength: [
      '{{attribute}} 必须在${minLength}-${maxLength}个字符之间',
      { attribute: undefined,  minLength: undefined, maxLength: undefined },
    ],
  },
  range: {
    invalid: [
      '{{attribute}} 必须是 {{ranges}} 中的任意一个值',
      {
        attribute: undefined,
        ranges: (values: Array<string | number>) => JSON.stringify(values),
      }
    ],
  },
  number: {
    invalid: ['{{attribute}} 必须是个数字', { attribute: undefined }],
    integer: ['{{attribute}} 必须是个整数', { attribute: undefined }],
    tooSmall: ['{{attribute}} 必须大于{{min}}', { attribute: undefined, min: undefined }],
    tooLarge: ['{{attribute}} 必须小于{{max}}', { attribute: undefined, max: undefined }],
    between: ['{{attribute}} 必须在{{min}}和{{max}}之间', { attribute: undefined, min: undefined, max: undefined }],
  },
  url: {
    invalid: ['{{attribute}} 必须是超链接', { attribute: undefined }],
  },
  boolean: {
    invalid: ['{{attribute}} 必须是布尔值', { attribute: undefined }],
  },
  file: {
    invalid: ['{{attribute}} 必须是文件', { attribute: undefined }],
    tooLarge: ['{{attribute}} 文件尺寸超过 {{maxSize}}', { attribute: undefined, maxSize: undefined }],
    mimeType: ['{{attribute}} 的文件类型不匹配', { attribute: undefined }],
  },
};

export default zh;
